﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SchEdu.Framework.DataModel
{
    public class Resource
    {
        SchEduDataSet.WorkCenterRow workCenter;

        public SchEduDataSet.WorkCenterRow WorkCenter
        {
            get { return workCenter; }
        }

        SchEduDataSet.MachineRow machine;

        public SchEduDataSet.MachineRow Machine
        {
            get { return machine; }
        }

        public Resource(SchEduDataSet.WorkCenterRow workCenter)
        {
            this.workCenter = workCenter;
        }

        public Resource(SchEduDataSet.MachineRow machine)
        {
            this.machine = machine;
        }

        public int AvailableDate
        {
            get
            {
                if (workCenter != null)
                {
                    return workCenter.AvailabilityDate;
                }
                else
                {
                    return machine.AvailabilityDate;
                }
            }
        }

        public SchEduDataSet.WorkCenterRow ResourceWorkCenter
        {
            get
            {
                if (workCenter != null)
                {
                    return workCenter;
                }
                else
                {
                    return machine.WorkCenterRow;
                }
            }
        }
    }
}
